﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace vfife_building_algorithm
{
    public partial class Ramp_Setting : Form
    {
        public ElementForce elforce;

        public Ramp_Setting(ElementForce elmtforce)
        {
            InitializeComponent();
            this.elforce = elmtforce;
        }
        

        private void button1_Click(object sender, EventArgs e)
        {
            double rtime = double.Parse(this.textBox1.Text.ToString());
            double EndValue = double.Parse(this.textBox2.Text.ToString());
            double TimeStep = this.elforce.Cacu_Para.h;
            double EndTime = this.elforce.Cacu_Para.endTime;
            double[] x_exforce = this.elforce.x_exforce;
            double[] y_exforce = this.elforce.y_exforce;
            double SizeOfForce = this.elforce.x_exforce.Length;
            for (int i = 0; i < SizeOfForce; i++){
          
                x_exforce[i] = EndTime*ramp_step(rtime, TimeStep*i);
               
            }
            this.elforce.x_exforce = x_exforce;
            
            this.Close();
        }







        private double ramp_step(double rtime, double time)
        {
            double Pt;
            if (time > rtime)
            {
                Pt = 1.0;
            }
            else
            {
                Pt = time / rtime;
            }
            return Pt;
        }
    }
}
